//
//  KQMessageType.swift
//  JChat
//
//  Created by JIGUANG on 10/04/2017.
//  Copyright © 2017 HXHG. All rights reserved.
//

import Foundation
import KQChatSDK

@objc public enum MessageTargetType: Int {
    case single = 1
    case group = 2
    case chatRoom = 3
}

@objc public enum CustomMessageNextType: Int {
    /// 打电话
    case call = 1
    /// 跳转到网页
    case jumpWebView = 2
    /// 跳转到报修工单
    case jumpRepair = 3
    /// 刷新界面
    case refresh = 4
    /// 拉取自动回复
    case pullAutoAnswer = 5
    /// 和管家聊天
    case chatWithKeeper = 6

}

@objc public protocol KQMessageType: AnyObject {
    
    var name: String { get }
    var identifier: UUID { get }
    var msgId: String { get }
    var date: Date { get }
    var sender: WFCCUserInfo? { get }
    var senderAvator: UIImage? { get }
    var receiver: WFCCUserInfo? { get }
    var content: KQMessageContentType { get }
    var options: KQMessageOptions { get }
    var updateSizeIfNeeded: Bool { get }
    var unreadCount: Int { get }
    var jmessage: WFCCMessage? { get }
}

@objc public protocol KQMessageDelegate: NSObjectProtocol {
    @objc optional func message(message: KQMessageType, videoData data: Data?)
    @objc optional func message(message: KQMessageType, voiceData data: Data?, duration: Double)
    @objc optional func message(message: KQMessageType, fileData data: Data?, fileName: String?, fileType: String?)
    @objc optional func message(message: KQMessageType, location address: String?, lat: Double, lon: Double)
    @objc optional func message(message: KQMessageType, image: UIImage?)
    // user 对象是为了提高效率，如果 user 已经加载出来了，就直接使用，不需要重新去获取一次
    @objc optional func message(message: KQMessageType, user: WFCCUserInfo?, businessCardName: String, businessCardAppKey: String)
    @objc optional func clickTips(message: KQMessageType)
    @objc optional func tapAvatarView(message: KQMessageType)
    @objc optional func longTapAvatarView(message: KQMessageType)
    @objc optional func tapUnreadTips(message: KQMessageType)
    /// 点击自定义消息 下一步操作代理
    /// 1.nextType=call，param=18595751198
    /// 2.nextType=jumpWebView，param=www.baidu.com
    /// 3.nextType=jumpRepair，param=123456(工单id)
    /// 4.nextType=pullAutoAnswer，param=（问题ID）
    /// 5.nextType=chatWithKeeper，param=KQMessageHouseKeeperModel
    @objc optional func tapCustom(message: KQMessageType, nextType: CustomMessageNextType, param: Any?)
}
